package com.foreknow.demo07;

import java.util.Scanner;

/**
 * 定义一些有返回值类型的方法
 */
public class TestMethod1 {
      public int a() {
        return 12; //它表示这个方法的最终结果
      }

      public String b() {
        return "tom";
      }

      public double c() {
        return 3.14;
      }

      public boolean d() {
        return true;
      }

      public int[] e() {
          int[] array = {1,2,3,4,5};
          return array;
        }

      public Person f() {  //int
        Person person = new Person("tom",40); //int a = 12;
        return person;
      }

      public Scanner g() {
        Scanner input = new Scanner(System.in);
        return input;
      }

        public static void main(String[] args) {
          TestMethod1 testMethod1 = new TestMethod1();
          int a = testMethod1.a();
          System.out.println(a);
          String name =  testMethod1.b();
          System.out.println(name);
          double f = testMethod1.c();
          System.out.println(f);
          boolean isRigth = testMethod1.d();
          System.out.println(isRigth);

          System.out.println("-------------------------------");

          int[] array = testMethod1.e();
          for(int i = 0;i<array.length;i++){
            System.out.println(array[i]);
          }

          System.out.println("-------------------------------");
          Person person = testMethod1.f();
          person.eat();
      }
}
